<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/5/24
 * Time: 13:21
 */
class QuiltMsgtpl extends BaseMsgtpl
{
    /**
     * 发指派订单消息
     */
    public function sendBuyMessage($orderInfo,$accountId,$confId){


        $condition = array(
            'user_id' => $orderInfo['user_id'],
            'account_id' => $accountId
        );
        //查询微信用户信息
        $wechatUser = D('Wechat/WechatUser')->getInfo($condition,'openid,subscribe');

        $url = C('site_url').'/base/Quilt/shopIndex/conf_id/'.$confId;
        if($wechatUser['subscribe']) {
            $this->wxTplSign = '_hHj0eU1ZQ7yorFomzpQvFV21NxQj8S_bqolOO9sbBk';

            //组消息内容
            $info = array(
                'first' => array("value" => '你已成功购买'.$orderInfo['goods_name'], 'color' => '#173177'),
                'keyword1' => array("value" => $orderInfo['username']),
                'keyword2' => array("value" => $orderInfo['order_price'], "color" => "#173177"),
                'keyword3' => array("value" => date('Y-m-d H:i'), "color" => "#173177"),
                'remark' => array("value" => '详情请登录系统查看'),
            );

            $this->wxObj->messageTpl($this->wechatInfo['appid'], $this->wechatInfo['appsecret'], $wechatUser['openid'], $this->wxTplSign, $info, $url);
        }
        return true;
    }

}